<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('参合农民档案管理列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>家庭编号：</label>
                                <input type="text" name="familyId"/>
                            </li>
                            <li>
                                <label>农合证号：</label>
                                <input type="text" name="ruralCardId"/>
                            </li>
                            <li>
                                <label>医疗证号：</label>
                                <input type="text" name="medicalCardId"/>
                            </li>
                            <!--<li>
                                <label>户内编号：</label>
                                <input type="text" name="indoorId"/>
                            </li>-->
                            <li>
                                <label>姓名：</label>
                                <input type="text" name="name"/>
                            </li>
                            <!--<li>
                                <label>与户主关系：</label>
                                <select name="relation" th:with="type=${@dict.getType('farmer_relation')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>-->
                            <li>
                                <label>身份证号：</label>
                                <input type="text" name="idCard"/>
                            </li>
                            <!--<li>
                                <label>性别：</label>
                                <select name="sex" th:with="type=${@dict.getType('farmer_sex')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>健康状况：</label>
                                <input type="text" name="health"/>
                            </li>
                            <li>
                                <label>民族：</label>
                                <input type="text" name="nation"/>
                            </li>
                            <li>
                                <label>文化程度：</label>
                                <select name="culture" th:with="type=${@dict.getType('farmer_culture')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>年龄：</label>
                                <input type="text" name="age"/>
                            </li>
                            <li>
                                <label>出生日期：</label>
                                <input type="text" class="time-input" placeholder="请选择出生日期" name="birthday"/>
                            </li>
                            <li>
                                <label>人员属性：</label>
                                <input type="text" name="proprety"/>
                            </li>
                            <li>
                                <label>是否农村户口：</label>
                                <select name="ruralHousehold" th:with="type=${@dict.getType('farmer_rural_household')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>职业：</label>
                                <input type="text" name="job"/>
                            </li>
                            <li>
                                <label>工作单位：</label>
                                <input type="text" name="workPlace"/>
                            </li>
                            <li>
                                <label>联系电话：</label>
                                <input type="text" name="phone"/>
                            </li>
                            <li>
                                <label>常住地址：</label>
                                <input type="text" name="address"/>
                            </li>-->
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:farmer:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:farmer:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:farmer:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:farmer:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:farmer:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:farmer:remove')}]];
        var relationDatas = [[${@dict.getType('farmer_relation')}]];
        var sexDatas = [[${@dict.getType('farmer_sex')}]];
        var cultureDatas = [[${@dict.getType('farmer_culture')}]];
        var ruralHouseholdDatas = [[${@dict.getType('farmer_rural_household')}]];
        var prefix = ctx + "system/farmer";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "参合农民档案管理",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '',
                    visible: false
                },
                {
                    field: 'familyId',
                    title: '家庭编号'
                },
                {
                    field: 'ruralCardId',
                    title: '农合证号'
                },
                {
                    field: 'medicalCardId',
                    title: '医疗证号'
                },
                {
                    field: 'indoorId',
                    title: '户内编号'
                },
                {
                    field: 'name',
                    title: '姓名'
                },
                {
                    field: 'relation',
                    title: '与户主关系',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(relationDatas, value);
                    }
                },
                {
                    field: 'idCard',
                    title: '身份证号'
                },
                {
                    field: 'sex',
                    title: '性别',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(sexDatas, value);
                    }
                },
                {
                    field: 'health',
                    title: '健康状况'
                },
                {
                    field: 'nation',
                    title: '民族'
                },
                {
                    field: 'culture',
                    title: '文化程度',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(cultureDatas, value);
                    }
                },
                {
                    field: 'age',
                    title: '年龄'
                },
                {
                    field: 'birthday',
                    title: '出生日期'
                },
                {
                    field: 'proprety',
                    title: '人员属性'
                },
                {
                    field: 'ruralHousehold',
                    title: '是否农村户口',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(ruralHouseholdDatas, value);
                    }
                },
                {
                    field: 'job',
                    title: '职业'
                },
                {
                    field: 'workPlace',
                    title: '工作单位'
                },
                {
                    field: 'phone',
                    title: '联系电话'
                },
                {
                    field: 'address',
                    title: '常住地址'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>
